<?php defined('_JEXEC') or die('Restricted access');
$orders = $this->orders;
?>
<div class="main-content clear-fix" id="shopcart-page">
    <div class="content-left">				 						
        <div id="order-list-2">
            <!--
            <ul class="main-order-list">
                <li><a href="shopcart.php">Seneste bestilling</a></li>						
                <li><a class="activeCate" href="shopcart.php">Mine varer</a></li>
            </ul>
            -->
        </div>
         
    </div>
    <div class="content-right" id="order-right">
        <h2>Yoghurt og creme fraiche</h2>
        <div id="order-table">
            <ul class="table">
                <li class="table-history-caption clear-fix">
                    <div class="table-col table-col-8">Dato</div>
                    <div class="table-col table-col-9">Ordrenummer</div>
                    <div class="table-col table-col-10">Beløb</div>
                    <div class="table-col table-col-11">Status</div>
                </li>
                <?php foreach($orders as $order){ ?>						
                <li class="table-each-category clear-fix">
                    <div class="table-category clear-fix">
                        <div class="table-col table-col-8"><?php echo date("d.m.Y", $order->order_date);?></div>
                        <div class="table-col table-col-9"><?php echo sprintf("%06d", $order->order_id); ?></div>
                        <div class="table-col table-col-10"><?php echo $order->order_total; ?> kr</div>
                        <div class="table-col table-col-11"><?php if($order->order_status) echo 'Ekspederet'; else echo 'Ikke-udførte';?></div>
                    </div>								
                    <div class="table-category-content">
                    
                        <ul class="table">
                            <li class="table-caption clear-fix">
                                <div class="table-col table-col-1">Varenr</div>
                                <div class="table-col table-col-2">Varenavn</div>
                                <div class="table-col table-col-3">Producent</div>
                                <div class="table-col table-col-4">Enhed</div>
                                <div class="table-col table-col-5">Enhed/colli</div>
                                <div class="table-col table-col-6">Pris/enhed</div>
                                <div class="table-col table-col-7">Antal colli</div>
                            </li>
                            <?php foreach($order->cart as $pro){ ?>							
                            <li class="table-row clear-fix">
                                <div class="table-col table-col-1">
                                    <a class="info-ico" <?php echo 'data-reveal-id="prdDetail-'.$pro->id.'"';?>>Info</a>
                                    <p><?php echo $pro->number?></p>
                                    <div class="clear"></div>
                                </div>
                                <div class="table-col table-col-2"><?php echo $pro->name?></div>
                                <div class="table-col table-col-3">
                                    <p><?php echo $pro->com_name?></p>
                                    <div class="col-3-setting">
                                        <?php $arrType = explode(',', $pro->type);
											for($i=1; $i<=6; $i++){
												if(in_array($i, $arrType)){
													if($i == 1) $title = 'title="Fuldkornsmærket"';
													if($i == 2) $title = 'title="Økologisk"';
													if($i == 3) $title = 'title="Fairtrade"';
													if($i == 4) $title = 'title="MSC"';
													if($i == 5) $title = 'title="Frost"';
													if($i == 6) $title = 'title="Temperature"';
										?>
												<a class="setting-<?php echo $i?>" <?php echo $title;?>>Setting <?php echo $i?></a>
										<?php 
												}
											}?>									
                                        <div class="clear"></div>
                                    </div>								
                                    <div class="clear"></div>
                                </div>
                                <div class="table-col table-col-4"><?php echo $pro->unit?></div>
                                <div class="table-col table-col-5"><?php echo $pro->parcel?></div>
                                <div class="table-col table-col-6"><?php echo $pro->price?> kr</div>
                                <div class="table-col table-col-7">
                                    <input class="table-quantity" type="text" value="1"/>
                                    <input type="hidden" value="<?php echo $pro->id;?>"/>									
                                    <input class="styled" type="checkbox" checked="checked" value="<?php echo $pro->id;?>" />
                                    <div id="prdDetail-<?php echo $pro->id;?>" class="reveal-modal prdDetail-div">
                                        <iframe src="index.php?option=com_ecommerce&view=detail&id=<?php echo $pro->id;?>&tmpl=component" style="overflow:hidden; width:700px; height:645px;"></iframe>										
                                         <a id="close-reveal-modal" class="close-reveal-modal"></a>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                            </li>										
                            <?php }?>				
                        </ul>
                        <a id="btnReorder" href="javascript:void(0);">Reorder</a>
                        <div class="clear"></div>
                        
                    </div>
                    <div class="clear"></div>
                </li>
                <?php } ?>
            </ul>
        </div>                
    </div>			
</div>